Bicubic Interpolation
   HOME

TheInfoList



OR:

In
mathematics Mathematics is an area of knowledge that includes the topics of numbers, formulas and related structures, shapes and the spaces in which they are contained, and quantities and their changes. These topics are represented in modern mathematics ...
, bicubic interpolation is an extension of
cubic interpolation In numerical analysis, a cubic Hermite spline or cubic Hermite interpolator is a spline where each piece is a third-degree polynomial specified in Hermite form, that is, by its values and first derivatives at the end points of the correspondin ...
(not to be confused with cubic spline interpolation, a method of applying cubic interpolation to a data set) for
interpolating In the mathematics, mathematical field of numerical analysis, interpolation is a type of estimation, a method of constructing (finding) new data points based on the range of a discrete set of known data points. In engineering and science, one ...
data points on a
two-dimensional In mathematics, a plane is a Euclidean ( flat), two-dimensional surface that extends indefinitely. A plane is the two-dimensional analogue of a point (zero dimensions), a line (one dimension) and three-dimensional space. Planes can arise as ...
regular grid A regular grid is a tessellation of ''n''-dimensional Euclidean space by congruent parallelotopes (e.g. bricks). Its opposite is irregular grid. Grids of this type appear on graph paper and may be used in finite element analysis, finite vol ...
. The interpolated surface (meaning the kernel shape, not the image) is smoother than corresponding surfaces obtained by
bilinear interpolation In mathematics, bilinear interpolation is a method for interpolating functions of two variables (e.g., ''x'' and ''y'') using repeated linear interpolation. It is usually applied to functions sampled on a 2D rectilinear grid, though it can be ...
or
nearest-neighbor interpolation Nearest-neighbor interpolation (also known as proximal interpolation or, in some contexts, point sampling) is a simple method of multivariate interpolation in one or more dimensions. Interpolation is the problem of approximating the value of ...
. Bicubic interpolation can be accomplished using either
Lagrange polynomial In numerical analysis, the Lagrange interpolating polynomial is the unique polynomial of lowest degree that interpolates a given set of data. Given a data set of coordinate pairs (x_j, y_j) with 0 \leq j \leq k, the x_j are called ''nodes'' an ...
s,
cubic spline In numerical analysis, a cubic Hermite spline or cubic Hermite interpolator is a spline where each piece is a third-degree polynomial specified in Hermite form, that is, by its values and first derivatives at the end points of the correspondin ...
s, or cubic convolution algorithm. In
image processing An image is a visual representation of something. It can be two-dimensional, three-dimensional, or somehow otherwise feed into the visual system to convey information. An image can be an artifact, such as a photograph or other two-dimensio ...
, bicubic interpolation is often chosen over bilinear or nearest-neighbor interpolation in image resampling, when speed is not an issue. In contrast to bilinear interpolation, which only takes 4
pixel In digital imaging, a pixel (abbreviated px), pel, or picture element is the smallest addressable element in a raster image, or the smallest point in an all points addressable display device. In most digital display devices, pixels are the ...
s (2×2) into account, bicubic interpolation considers 16 pixels (4×4). Images resampled with bicubic interpolation can have different interpolation artifacts, depending on the b and c values chosen.


Computation

Suppose the function values f and the derivatives f_x, f_y and f_ are known at the four corners (0,0), (1,0), (0,1), and (1,1) of the unit square. The interpolated surface can then be written as :p(x,y) = \sum\limits_^3 \sum_^3 a_ x^i y^j. The interpolation problem consists of determining the 16 coefficients a_. Matching p(x,y) with the function values yields four equations: # f(0,0) = p(0,0) = a_, # f(1,0) = p(1,0) = a_ + a_ + a_ + a_, # f(0,1) = p(0,1) = a_ + a_ + a_ + a_, # f(1,1) = p(1,1) = \textstyle \sum\limits_^3 \sum\limits_^3 a_. Likewise, eight equations for the derivatives in the x and the y directions: # f_x(0,0) = p_x(0,0) = a_, # f_x(1,0) = p_x(1,0) = a_ + 2a_ + 3a_, # f_x(0,1) = p_x(0,1) = a_ + a_ + a_ + a_, # f_x(1,1) = p_x(1,1) = \textstyle \sum\limits_^3 \sum\limits_^3 a_ i, # f_y(0,0) = p_y(0,0) = a_, # f_y(1,0) = p_y(1,0) = a_ + a_ + a_ + a_, # f_y(0,1) = p_y(0,1) = a_ + 2a_ + 3a_, # f_y(1,1) = p_y(1,1) = \textstyle \sum\limits_^3 \sum\limits_^3 a_ j. And four equations for the xy mixed partial derivative: # f_(0,0) = p_(0,0) = a_, # f_(1,0) = p_(1,0) = a_ + 2a_ + 3a_, # f_(0,1) = p_(0,1) = a_ + 2a_ + 3a_, # f_(1,1) = p_(1,1) = \textstyle \sum\limits_^3 \sum\limits_^3 a_ i j. The expressions above have used the following identities: :p_x(x,y) = \textstyle \sum\limits_^3 \sum\limits_^3 a_ i x^ y^j, :p_y(x,y) = \textstyle \sum\limits_^3 \sum\limits_^3 a_ x^i j y^, :p_(x,y) = \textstyle \sum\limits_^3 \sum\limits_^3 a_ i x^ j y^. This procedure yields a surface p(x,y) on the
unit square In mathematics, a unit square is a square whose sides have length . Often, ''the'' unit square refers specifically to the square in the Cartesian plane with corners at the four points ), , , and . Cartesian coordinates In a Cartesian coordin ...
,1\times ,1/math> that is continuous and has continuous derivatives. Bicubic interpolation on an arbitrarily sized
regular grid A regular grid is a tessellation of ''n''-dimensional Euclidean space by congruent parallelotopes (e.g. bricks). Its opposite is irregular grid. Grids of this type appear on graph paper and may be used in finite element analysis, finite vol ...
can then be accomplished by patching together such bicubic surfaces, ensuring that the derivatives match on the boundaries. Grouping the unknown parameters a_ in a vector :\alpha=\left begina_&a_&a_&a_&a_&a_&a_&a_&a_&a_&a_&a_&a_&a_&a_&a_\end\rightT and letting :x=\left beginf(0,0)&f(1,0)&f(0,1)&f(1,1)&f_x(0,0)&f_x(1,0)&f_x(0,1)&f_x(1,1)&f_y(0,0)&f_y(1,0)&f_y(0,1)&f_y(1,1)&f_(0,0)&f_(1,0)&f_(0,1)&f_(1,1)\end\rightT, the above system of equations can be reformulated into a matrix for the linear equation A\alpha=x. Inverting the matrix gives the more useful linear equation A^x=\alpha, where :A^=\left[\begin 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ -3 & 3 & 0 & 0 & -2 & -1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 2 & -2 & 0 & 0 & 1 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & -3 & 3 & 0 & 0 & -2 & -1 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 2 & -2 & 0 & 0 & 1 & 1 & 0 & 0 \\ -3 & 0 & 3 & 0 & 0 & 0 & 0 & 0 & -2 & 0 & -1 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & -3 & 0 & 3 & 0 & 0 & 0 & 0 & 0 & -2 & 0 & -1 & 0 \\ 9 & -9 & -9 & 9 & 6 & 3 & -6 & -3 & 6 & -6 & 3 & -3 & 4 & 2 & 2 & 1 \\ -6 & 6 & 6 & -6 & -3 & -3 & 3 & 3 & -4 & 4 & -2 & 2 & -2 & -2 & -1 & -1 \\ 2 & 0 & -2 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 2 & 0 & -2 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 1 & 0 \\ -6 & 6 & 6 & -6 & -4 & -2 & 4 & 2 & -3 & 3 & -3 & 3 & -2 & -1 & -2 & -1 \\ 4 & -4 & -4 & 4 & 2 & 2 & -2 & -2 & 2 & -2 & 2 & -2 & 1 & 1 & 1 & 1 \end\right], which allows \alpha to be calculated quickly and easily. There can be another concise matrix form for 16 coefficients: :\begin f(0,0)&f(0,1)&f_y (0,0)&f_y (0,1)\\f(1,0)&f(1,1)&f_y (1,0)&f_y (1,1)\\f_x (0,0)&f_x (0,1)&f_ (0,0)&f_ (0,1)\\f_x (1,0)&f_x (1,1)&f_ (1,0)&f_ (1,1) \end = \begin 1&0&0&0\\1&1&1&1\\0&1&0&0\\0&1&2&3 \end \begin a_&a_&a_&a_\\a_&a_&a_&a_\\a_&a_&a_&a_\\a_&a_&a_&a_ \end \begin 1&1&0&0\\0&1&1&1\\0&1&0&2\\0&1&0&3 \end, or : \begin a_&a_&a_&a_\\a_&a_&a_&a_\\a_&a_&a_&a_\\a_&a_&a_&a_ \end = \begin 1&0&0&0\\0&0&1&0\\-3&3&-2&-1\\2&-2&1&1 \end \begin f(0,0)&f(0,1)&f_y (0,0)&f_y (0,1)\\f(1,0)&f(1,1)&f_y (1,0)&f_y (1,1)\\f_x (0,0)&f_x (0,1)&f_ (0,0)&f_ (0,1)\\f_x (1,0)&f_x (1,1)&f_ (1,0)&f_ (1,1) \end \begin 1&0&-3&2\\0&0&3&-2\\0&1&-2&1\\0&0&-1&1 \end, where :p(x,y)=\begin1 &x&x^2&x^3\end \begin a_&a_&a_&a_\\a_&a_&a_&a_\\a_&a_&a_&a_\\a_&a_&a_&a_ \end \begin1\\y\\y^2\\y^3\end.


Extension to rectilinear grids

Often, applications call for bicubic interpolation using data on a rectilinear grid, rather than the unit square. In this case, the identities for p_x, p_y, and p_ become :p_x(x,y) = \textstyle \sum\limits_^3 \sum\limits_^3 \frac, :p_y(x,y) = \textstyle \sum\limits_^3 \sum\limits_^3 \frac, :p_(x,y) = \textstyle \sum\limits_^3 \sum\limits_^3 \frac, where \Delta x is the x spacing of the cell containing the point (x,y) and similar for \Delta y. In this case, the most practical approach to computing the coefficients \alpha is to let :x=\left[\beginf(0,0)&f(1,0)&f(0,1)&f(1,1)&\Delta x f_x(0,0)&\Delta xf_x(1,0)&\Delta x f_x(0,1)&\Delta x f_x(1,1)&\Delta y f_y(0,0)&\Delta y f_y(1,0)&\Delta y f_y(0,1)&\Delta y f_y(1,1)&\Delta x \Delta y f_(0,0)&\Delta x \Delta y f_(1,0)&\Delta x \Delta y f_(0,1)&\Delta x \Delta y f_(1,1)\end\right]^T, then to solve \alpha=A^x with A as before. Next, the normalized interpolating variables are computed as :\overline = \frac, :\overline = \frac where x_0, x_1, y_0, and y_1 are the x and y coordinates of the grid points surrounding the point (x,y). Then, the interpolating surface becomes :p(x,y) = \sum\limits_^3 \sum_^3 a_ ^i ^j.


Finding derivatives from function values

If the derivatives are unknown, they are typically approximated from the function values at points neighbouring the corners of the unit square, e.g. using
finite differences A finite difference is a mathematical expression of the form . If a finite difference is divided by , one gets a difference quotient. The approximation of derivatives by finite differences plays a central role in finite difference methods for the ...
. To find either of the single derivatives, f_x or f_y, using that method, find the slope between the two ''surrounding'' points in the appropriate axis. For example, to calculate f_x for one of the points, find f(x,y) for the points to the left and right of the target point and calculate their slope, and similarly for f_y. To find the cross derivative f_, take the derivative in both axes, one at a time. For example, one can first use the f_x procedure to find the x derivatives of the points above and below the target point, then use the f_y procedure on those values (rather than, as usual, the values of f for those points) to obtain the value of f_(x,y) for the target point. (Or one can do it in the opposite direction, first calculating f_y and then f_x from those. The two give equivalent results.) At the edges of the dataset, when one is missing some of the surrounding points, the missing points can be approximated by a number of methods. A simple and common method is to assume that the slope from the existing point to the target point continues without further change, and using this to calculate a hypothetical value for the missing point.


Bicubic convolution algorithm

Bicubic spline interpolation requires the solution of the linear system described above for each grid cell. An interpolator with similar properties can be obtained by applying a
convolution In mathematics (in particular, functional analysis), convolution is a mathematical operation on two functions ( and ) that produces a third function (f*g) that expresses how the shape of one is modified by the other. The term ''convolution'' ...
with the following kernel in both dimensions: :W(x) = \begin (a+2), x, ^3-(a+3), x, ^2+1 & \text , x, \leq 1, \\ a, x, ^3-5a, x, ^2+8a, x, -4a & \text 1 < , x, < 2, \\ 0 & \text, \end where a is usually set to −0.5 or −0.75. Note that W(0)=1 and W(n)=0 for all nonzero integers n. This approach was proposed by Keys, who showed that a=-0.5 produces third-order convergence with respect to the sampling interval of the original function. If we use the matrix notation for the common case a=-0.5, we can express the equation in a more friendly manner: :p(t) = \tfrac \begin 1 & t & t^2 & t^3 \\ \end \begin 0 & 2 & 0 & 0 \\ -1 & 0 & 1 & 0 \\ 2 & -5 & 4 & -1 \\ -1 & 3 & -3 & 1 \\ \end \begin f_ \\ f_0 \\ f_1 \\ f_2 \\ \end for t between 0 and 1 for one dimension. Note that for 1-dimensional cubic convolution interpolation 4 sample points are required. For each inquiry two samples are located on its left and two samples on the right. These points are indexed from −1 to 2 in this text. The distance from the point indexed with 0 to the inquiry point is denoted by t here. For two dimensions first applied once in x and again in y: :b_ = p(t_x, f_, f_, f_, f_), :b_ = p(t_x, f_, f_, f_, f_), :b_ = p(t_x, f_, f_, f_, f_), :b_ = p(t_x, f_, f_, f_, f_), :p(x,y) = p(t_y, b_, b_, b_, b_).


Use in computer graphics

The bicubic algorithm is frequently used for scaling images and video for display (see bitmap resampling). It preserves fine detail better than the common bilinear algorithm. However, due to the negative lobes on the kernel, it causes overshoot (haloing). This can cause
clipping Clipping may refer to: Words * Clipping (morphology), the formation of a new word by shortening it, e.g. "ad" from "advertisement" * Clipping (phonetics), shortening the articulation of a speech sound, usually a vowel * Clipping (publications) ...
, and is an artifact (see also
ringing artifacts In signal processing, particularly digital image processing, ringing artifacts are artifacts that appear as spurious signals near sharp transitions in a signal. Visually, they appear as bands or "ghosts" near edges; audibly, they appear as "e ...
), but it increases
acutance In photography, acutance describes a subjective perception of sharpness that is related to the edge contrast of an image. Acutance is related to the amplitude of the derivative of brightness with respect to space. Due to the nature of the huma ...
(apparent sharpness), and can be desirable.


See also

*
Spatial anti-aliasing In digital signal processing, spatial anti-aliasing is a technique for minimizing the distortion artifacts ( aliasing) when representing a high-resolution image at a lower resolution. Anti-aliasing is used in digital photography, computer graphi ...
*
Bézier surface Bézier surfaces are a species of mathematical spline used in computer graphics, computer-aided design, and finite element modeling. As with Bézier curves, a Bézier surface is defined by a set of control points. Similar to interpolation in man ...
*
Bilinear interpolation In mathematics, bilinear interpolation is a method for interpolating functions of two variables (e.g., ''x'' and ''y'') using repeated linear interpolation. It is usually applied to functions sampled on a 2D rectilinear grid, though it can be ...
*
Cubic Hermite spline In numerical analysis, a cubic Hermite spline or cubic Hermite interpolator is a spline where each piece is a third-degree polynomial specified in Hermite form, that is, by its values and first derivatives at the end points of the correspondi ...
, the one-dimensional analogue of bicubic spline *
Lanczos resampling filtering and Lanczos resampling are two applications of a mathematical formula. It can be used as a low-pass filter or used to smoothly interpolate the value of a digital signal between its samples. In the latter case it maps each sample of t ...
* Natural neighbor interpolation *
Sinc filter In signal processing, a sinc filter is an idealized filter that removes all frequency components above a given cutoff frequency, without affecting lower frequencies, and has linear phase response. The filter's impulse response is a sinc func ...
*
Spline interpolation In the mathematical field of numerical analysis, spline interpolation is a form of interpolation where the interpolant is a special type of piecewise polynomial called a spline. That is, instead of fitting a single, high-degree polynomial to all ...
*
Tricubic interpolation In the mathematical subfield numerical analysis, tricubic interpolation is a method for obtaining values at arbitrary points in 3D space of a function defined on a regular grid. The approach involves approximating the function locally by an exp ...
* Directional Cubic Convolution Interpolation


References


External links


Application of interpolation to elevation samples



Explanation and Java/C++ implementation of (bi)cubic interpolation

Excel Worksheet Function for Bicubic Lagrange Interpolation
{{DEFAULTSORT:Bicubic Interpolation Image processing Multivariate interpolation